home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / EDUCATE / EVAL106.ARJ / EVAL.DOC next >
Text File  |  1992-04-09  |  13KB  |  340 lines

  1.  
  2.  
  3.  
  4.      EVAL V1.06 Copyright (c) 1991-1992 Copy Con Incorporated        Page 1
  5.  
  6.  
  7.      TO PRINT THIS FILE, TYPE "COPY EVAL.DOC PRN" AT THE DOS PROMPT.
  8.  
  9.  
  10.      OVERVIEW
  11.      --------
  12.      EVAL is a mathematical expression evaluator, capable of evaluating
  13.      virtually any formula, including those with trigonometric functions,
  14.      complex numbers, and user-defined variables. Formulas are typed in at
  15.      the command line, and the formula and outcome (and optionally the
  16.      variable values) are immediately displayed on your screen, or can be
  17.      sent to any device or file via standard DOS redirection.
  18.  
  19.  
  20.      DISCLAIMER
  21.      ----------
  22.      EVAL is distributed on an "AS IS" basis without warranty, expressed or
  23.      implied. Considerable testing effort has been expended, but the user
  24.      is advised to check the program's suitability before relying on it.
  25.      The user assumes full risk as to the results of using this program.
  26.      Any liability of the author will be limited exclusively to product
  27.      replacement. In no event shall the author be liable for any incidental
  28.      or consequential damages arising from the use, or inability to use
  29.      this program.
  30.  
  31.  
  32.      REGISTRATION
  33.      ------------
  34.      The unregistered version of EVAL is freely distributable and fully
  35.      functional, and may be used for a 30-day trial period. If you plan to
  36.      continue using EVAL after the trial period, you are obligated to pay
  37.      the modest registration fee of $20. Registered users will receive the
  38.      latest version of EVAL with the "nag" messages removed, along with a
  39.      smaller, math-chip version of EVAL. Registration also entitles you to
  40.      one free upgrade upon request, and half-priced subsequent upgrades.
  41.  
  42.      All registration information is contained in the REGISTER.TXT file. If
  43.      that file is missing, register by sending a check or money order for
  44.      $20 in U.S. dollars, drawn on a U.S. bank, to:
  45.  
  46.         Copy Con Incorporated
  47.         P.O. Box 23255
  48.         Baltimore, MD 21203-5255
  49.  
  50.      Please specify 3.5" or 5.25" diskette. MD residents add 5% sales tax.
  51.      We thank you for your support.
  52.  
  53.  
  54.  
  55.      EVAL V1.06 Copyright (c) 1991-1992 Copy Con Incorporated        Page 2
  56.  
  57.  
  58.      OPERATION
  59.      ---------
  60.      EVAL is activated from the command line, using the format
  61.  
  62.         EVAL [variable=expression;...] expression [options]
  63.  
  64.      Expressions are mathematical formulas built with the supported
  65.      functions, operators, constants and variables.
  66.  
  67.  
  68.      FUNCTIONS
  69.      ---------
  70.      Following are the functions that EVAL supports:
  71.  
  72.         Function  Description
  73.         --------  -----------
  74.           abs     Absolute value
  75.           acos    Arc cosine
  76.           arg     Angle of input value in the complex plane
  77.           asin    Arc sine
  78.           atan    Arc tangent
  79.           ceil    Smallest integer not less than input value (rounds up)
  80.           conj    Complex conjugate of input value
  81.           cos     Cosine
  82.           cosh    Hyperbolic cosine
  83.           csc     Cosecant
  84.           ctn     Cotangent
  85.           cub     Cube root
  86.           exp     E to the power of input value
  87.           flr     Largest integer not more than input value (rounds down)
  88.           frac    Fractional part of input value
  89.           imag    Imaginary part of complex number
  90.           int     Integer part of input value
  91.           ln      Natural logarithm
  92.           log     Natural logarithm (same as LN)
  93.           logt    Base 10 logarithm
  94.           norm    Square of the absolute value
  95.           rand    Random integer between 1 and input value (max 32767)
  96.           real    Real part of complex number
  97.           sec     Secant
  98.           sgn     Sign of input value (positive=1, negative=-1, zero=0)
  99.           sin     Sine
  100.           sinh    Hyperbolic sine
  101.           sqr     Square (x^2)
  102.           sqrt    Square root
  103.           tan     Tangent
  104.           tanh    Hyperbolic tangent
  105.  
  106.  
  107.  
  108.      EVAL V1.06 Copyright (c) 1991-1992 Copy Con Incorporated        Page 3
  109.  
  110.  
  111.      FUNCTIONS (continued)
  112.      ---------------------
  113.      Parentheses are optional when using functions; if they are not used,
  114.      only the first value following the function will be considered the
  115.      argument. For example:
  116.  
  117.         sin pi      evaluates to   sin(pi)
  118.         sin pi/2    evaluates to   sin(pi)/2
  119.         sin(pi/2)   evaluates to   sin(pi/2)
  120.  
  121.      Use of functions without parentheses is potentially dangerous, and it
  122.      is generally preferable to use parens to indicate function arguments.
  123.  
  124.  
  125.      OPERATORS
  126.      ---------
  127.      Each operator has a precedence, and operators with higher precedence
  128.      are evaluated before operators with lower precedence. Operators with
  129.      equal precedence are handled from left to right within a function.
  130.  
  131.      Precedence is indicated by order in the following table (the first
  132.      line has the highest precedence):
  133.  
  134.         Operators  Description
  135.         ---------  -----------
  136.            ( )     Left parenthesis,Right parenthesis
  137.             !      Unary factorial
  138.            + -     Unary sign
  139.             ^      Exponential
  140.           * / %    Multiplication,Division,Modulus
  141.            + -     Addition,Subtraction
  142.  
  143.      Where it is not ambiguous, multiplication can be indicated by
  144.      adjacency: 8(6-4) = 8*(6-4) = 16. Implicit multiplication is
  145.      potentially dangerous, and it is generally preferable to use * to
  146.      indicate multiplication.
  147.  
  148.  
  149.      CONSTANTS
  150.      ---------
  151.      EVAL supports numeric constants, and three alphabetic constants, PI,
  152.      E, and I. Alphabetic constants cannot directly follow functions; use
  153.      "cos pi" or "cos(pi)", not "cospi". Numeric constants need not be
  154.      separated from functions; "sin3" is okay.
  155.  
  156.      Numerical constants are entered just as you would ordinarily write
  157.      them. They can be preceeded with optional + or - signs. The following
  158.      are all valid numerical entries:
  159.  
  160.                         6.78    0.678   .678   -678
  161.  
  162.      Blanks are not permitted in numbers; the expression "7 8" would be
  163.      evaluated as 7 times 8, not 78.
  164.  
  165.  
  166.  
  167.      EVAL V1.06 Copyright (c) 1991-1992 Copy Con Incorporated        Page 4
  168.  
  169.  
  170.      CONSTANTS (continued)
  171.      ---------------------
  172.      Complex numbers can be used as easily as real numbers. Any of EVAL's
  173.      functions which are mathematically defined for complex values (like
  174.      SIN and EXP) will accept complex arguments. Complex numbers are
  175.      entered using the form "x+yi" where "i" is equivalent to the square
  176.      root of -1. The following are all valid complex number entries:
  177.  
  178.                          3+4i    5.2-3.45i    -63i
  179.  
  180.      Alphabetic constants can also be used as easily as real numbers; just
  181.      be careful not to string them together with functions, variables, and
  182.      other alphabetic constants; instead of "lne+api", use "ln e + a pi",
  183.      or "ln(e)+a*pi". "3pi/2" and "4i" are valid, as EVAL can tell where
  184.      one constant ends and another begins.
  185.  
  186.      Following are the approximate values of the alphabetic constants:
  187.  
  188.         PI = 3.14159265
  189.         E  = 2.71828183
  190.         I  = sqrt(-1)
  191.  
  192.  
  193.      VARIABLES
  194.      ---------
  195.      The letters A-Z (except for E and I) are set aside as user-definable
  196.      variables. Variables have a default value of 0, and are assigned
  197.      values using the equals sign. For example:
  198.  
  199.         EVAL a=pi;b=cub(8);b*cos(a)
  200.  
  201.      will assign a value of PI to A, a value of 2 to B, and will print out
  202.      the value of B times the cosine of A. As with alphabetic constants,
  203.      variables cannot directly follow functions; use a space delimiter, or
  204.      parentheses as above.
  205.  
  206.  
  207.      OPTIONS
  208.      -------
  209.      Options must be in the form "OPTION:value", as in "a:g" or "d:5". Case
  210.      is not important. Separate options with spaces.
  211.  
  212.      Option  Description
  213.      ------  -----------
  214.        A     Angular unit - whether angles will be expressed as degrees,
  215.              radians, or grads. Use the first letter of the unit, as in
  216.              "a:d". By default, angular units are expressed as radians.
  217.  
  218.        D     Significant Digits - the number of significant digits shown in
  219.              the expression outcome. Range is 1 thru 18; the default is 10.
  220.  
  221.        V     Show Variables - whether variables and their values will be
  222.              displayed as they are assigned values. If this option is set
  223.              to F, the formulas will also be shown. Default is Y.
  224.  
  225.  
  226.  
  227.      EVAL V1.06 Copyright (c) 1991-1992 Copy Con Incorporated        Page 5
  228.  
  229.  
  230.      ERROR MESSAGES
  231.      --------------
  232.      Following are error messages you may come across, along with their
  233.      descriptions and corresponding DOS errorlevels:
  234.  
  235.      Level  Message & Description
  236.      -----  ---------------------
  237.        1    Invalid input - you have attempted to use an unsupported
  238.             option, or you have exceeded an option's range.
  239.  
  240.        2    Invalid function '(function)' - you have attempted to use an
  241.             unsupported function. If it's a common function, let us know,
  242.             and we will add it.
  243.  
  244.        3    Abnormal program termination - either we erred in trapping a
  245.             math function, or the program has been corrupted somehow.
  246.             (Please drop us a line describing everything that led up to
  247.             this error, if you happen to come across it.)
  248.  
  249.        4    Expression too complex - your formula has 128 or more
  250.             constants, or more than 255 combined constants, functions, and
  251.             operators.
  252.  
  253.        5    Invalid operator '(op)' - you have attempted to use an
  254.             unsupported operator. If it's a common operator, let us know,
  255.             and we will add it.
  256.  
  257.        6    Mixmatched parentheses - there were an uneven amount of
  258.             parentheses, or a right parenthesis was encountered before its
  259.             matching left paren.
  260.  
  261.        7    Invalid use of functions - functions cannot be directly
  262.             followed by an operator (unless the operator is a "+" or "-"
  263.             indicating the sign of the value that follows).
  264.  
  265.        8    Invalid use of operators - operators cannot be directly
  266.             followed by other operators (unless the second operator is a
  267.             "+" or "-" indicating the sign of the value that follows).
  268.  
  269.        9    Invalid variable '(variable)' - an attempt was made to assign a
  270.             value to a constant or a non-variable.
  271.  
  272.       10    Division by zero - a denominator in your formula has a value of
  273.             zero, which is mathematically undefined.
  274.  
  275.       11    Argument domain/range - a function in the formula cannot
  276.             evaluate its input value, as the value is outside of the
  277.             function's range.
  278.  
  279.       12    Argument singularity - formula would result in a singularity.
  280.  
  281.       13    Overflow - the formula evaluates to a result greater than the
  282.             maximum allowed.
  283.  
  284.  
  285.  
  286.      EVAL V1.06 Copyright (c) 1991-1992 Copy Con Incorporated        Page 6
  287.  
  288.  
  289.      ERROR MESSAGES (continued)
  290.      --------------------------
  291.  
  292.      Level  Message & Description
  293.      -----  ---------------------
  294.       14    Underflow - the formula evaluates to a result less than the
  295.             minimum allowed.
  296.  
  297.       15    Total significance loss - formula would produce a result with
  298.             a total loss of significant digits.
  299.  
  300.  
  301.      EXAMPLES
  302.      --------
  303.      EVAL sqr3 d:4
  304.           displays the square root of 3, limited to 4 significant digits.
  305.           ( sqr3 evaluates to sqr(3) )
  306.  
  307.      EVAL a=pi ; b=cub 8 ; b*cos(a)
  308.           assigns a value of PI to A, a value of 2 to B, and displays the
  309.           value of B times the cosine of A. The values of A and B are also
  310.           displayed. (The spaces around the semicolons are not required)
  311.  
  312.      EVAL x=1/10 ; asin(5x) a:d v:n
  313.           assigns a value of .1 to X, and displays the arcsine of quantity
  314.           5 times X, expressed in degrees. The value of X is not displayed.
  315.           ( 5x is equivalent to 5*x )
  316.  
  317.      EVAL (2+4i)/(6-8i)
  318.           displays the result of the first complex number divided by the
  319.           second complex number.
  320.  
  321.      EVAL 3*4!
  322.           displays the result of 4 factorial, times 3. Since factorials are
  323.           higher in precedence than multiplication, use "EVAL (3*4)!" to
  324.           show 3 times 4 quantity, factorial.
  325.  
  326.  
  327.      CORRESPONDENCE
  328.      --------------
  329.      If you have questions, comments, suggestions, bug reports, etc.,
  330.      feel free to contact us by one of the following methods:
  331.  
  332.      1: By modem at The Programmer's Corner (301-596-1180 or 410-995-3744).
  333.         Send a message to user number 3000, and check back in a couple of
  334.         work days for a reply.
  335.  
  336.      2: By U.S. Mail at the address given on the first page. If you would
  337.         like a reply, please include a self-addressed, stamped envelope.
  338.  
  339.      We look forward to hearing from you.
  340.